package main

import (
	"fmt"
	"os"

	"github.com/bzsome/ChaoGom3u8/chaoM3u8"
	"github.com/bzsome/ChaoGom3u8/utils"
	"github.com/dustin/go-humanize"
)

func main() {
	m3u8Down := chaoM3u8.M3u8Down{
		Url:       "http://playertest.longtailvideo.com/adaptive/bipbop/gear4/prog_index.m3u8",
		SaveDir:   "downloads",
		WpSize:    5,
		PoolSize:  10,
		ChuckSize: 1024 * 100,
	}

	countTime := utils.New()
	m3u8Down.Down()
	exeTime := countTime.EndAndGetExeTime()
	fileInfo, _ := os.Stat(m3u8Down.GetSavePath())
	//文件大小
	fileSize := fileInfo.Size()
	fmt.Printf("%s 下载用时：%.2f 秒，保存路径：%s", humanize.Bytes(uint64(fileSize)), exeTime.Seconds(), m3u8Down.GetSavePath())
}
